Home:ALL Converter>undefined reference to `std::basic_stringstream' from static library on CentOS7

undefined reference to `std::basic_stringstream' from static library on CentOS7

Ask Time:2022-03-03T18:03:43         Author:abhi

Json Formatter

I am building my C++ code on CentOS7/gcc5.5 for a project which is trying to link a static library during the linking process. To be more precise, its a .net library installed as part of .net sdk version 6.0.

Its present here /usr/share/dotnet/packs/Microsoft.NETCore.App.Host.linux-x64/6.0.2/runtimes/linux-x64/native/libnethost.a from where I have copied it to a custom path in my workspace

The main project has more than one static libraries which it tries to link during linking. However only for this libnethost.a I am getting the below errors

/home/customPath/ThirdParty/dotNet/6.0.1/libnethost.a(fx_ver.cpp.o): In function `fx_ver_t::as_str() const': /root/runtime/src/native/corehost/fxr/fx_ver.cpp:73: undefined reference to `std::basic_stringstream<char, std::char_traits<char>, std::allocator<char> >::basic_stringstream()' /home/customPath/ThirdParty/dotNet/6.0.1/libnethost.a(fx_ver.cpp.o): In function `fx_ver_t::prerelease_glob() const':

This is the version of C++ present on the system

libstdc++-4.8.5-44.el7.i686
libstdc++-devel-4.8.5-44.el7.x86_64
libstdc++-4.8.5-44.el7.x86_64
libstdc++-devel-4.8.5-44.el7.i686

Excuse me for any obvious mistakes but I am not very clear about how the compiler works with Linux. I read about gcc5 using different ABI compared to previous versions but I am not sure how that works. Please help me figure this out.

Regards Abhishek

Author:abhi,eproduced under the CC 4.0 BY-SA copyright license with a link to the original source and this disclaimer.
Link to original article:https://stackoverflow.com/questions/71335279/undefined-reference-to-stdbasic-stringstream-from-static-library-on-centos7
yy